/*
 * Copyright 2006 Matt Jensen
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 */
package org.spectaql.metadata;

import java.io.Serializable;
import java.util.Collection;
import java.util.Iterator;

/**
 * <p>
 * <code>EntityMetadata</code> holds metadata on a single persistent entity class.
 * </p>
 */
public interface EntityMetadata extends Serializable
{
    /**
     * <p>
     * Get the entity class.
     * </p>
     *
     * @return {@link Class} entity class.
     */
    public Class<?> getEntityClass();

    /**
     * <p>
     * Get the entity name.
     * </p>
     * 
     * @return {@link String} entity name.
     */
    public String getEntityName();

    /**
     * <p>
     * Get the identifier class for the entity class.
     * </p>
     *
     * @return {@link Class} identifier class.
     */
    public Class<?> getIdentifierClass();

    /**
     * <p>
     * Get the metadata objects for all properties defined by this entity.
     * </p>
     *
     * @return {@link Collection} of {@link PropertyMetadata} instances.
     */
    public Collection<PropertyMetadata> getProperties();

    /**
     * <p>
     * Get an iterator over entity property names.
     * </p>
     * 
     * @return {@link Iterator} over {@link String} property names.
     */
    public Iterator<String> getPropertyNames();

    /**
     * <p>
     * Get the metadata for a single property.
     * </p>
     *
     * @param name the property name.
     * @return {@link PropertyMetadata} instance.
     * @throws IllegalArgumentException if the named property does not exist.
     */
    public PropertyMetadata getProperty(final String name) throws IllegalArgumentException;
}
